package com.mew.common.entity.game;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.mew.common.util.NumberUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;


@TableName("g_win_free")
@Data
@ToString
@NoArgsConstructor
@EqualsAndHashCode(of = {"roomId", "userId"})
public class WinFree {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    @TableField("user_id")
    private Long userId;
    @TableField("game_id")
    private Integer gameId;
    @TableField("room_id")
    private Integer roomId;
    /**
     * 押注
     */
    @TableField("bet")
    private Long bet;
    /**
     * 比倍
     */
    @TableField("bouns_bibei")
    private Integer bounsBibei;
    /**
     * 消除
     */
    @TableField("bouns_change")
    private Integer bounsChange;
    /**
     * 超级玛丽次数
     */
    @TableField("bouns_number")
    private Integer bounsNumber;
    /**
     *  超级玛丽 剩下的次数
     */
    @TableField("bouns_rate")
    private Integer bounsRate;
    /**
     * 押注金额
     */
    @TableField("bouns_type")
    private Integer bounsType;

    /**
     * 免费场次次数
     */
    @TableField("frees")
    private Integer frees;
    /**
     * 获得的免费总次数
     */
    @TableField("free_count")
    private Integer freeCount;
    /**
     * 跳跳高当前免费倍数
     */
    @TableField("free_rate")
    private Integer freeRate;
    /**
     * 中免费类型
     */
    @TableField("free_type")
    private Integer freeType;
    /**
     * 剩余费次数
     */
    @TableField("free_number")
    private Integer freeNumber;
    /**
     * 0未完成
     */
    @TableField("state")
    private Integer state;
    /**
     * json字符串
     */
    @TableField("json")
    private String json;
    @TableField("last_bet_number")
    private Long lastBetNumber;
    @TableField("last_win_number")
    private Long lastWinNumber;
    /**
     * 线数
     */
    @TableField("last_line_number")
    private Integer lastLineNumber;
    /**
     * 上一把图标
     */
    @TableField("last_icon")
    private String lastIcon;


    public static WinFree build(Long userId, Integer roomId){
        WinFree winFree = new WinFree();
        winFree.setRoomId(roomId);
        winFree.setUserId(userId);
        return winFree;
    }
    // true have
    public boolean validWinFree(){
        return !NumberUtil.isLtOne(frees)||!NumberUtil.isLtOne(bounsNumber)||!NumberUtil.isLtOne(bounsChange);
    }

}
